unit Colors;

interface

uses
  Graphics, GlobalRecordsAndEnums;

type
  TColors = class
    public
      ColorShowInfo: Boolean;
      ColorEditItems: Boolean;
      ColorShoppingList: Boolean;

      T1Item: TColor;
      T2Item: TColor;
      AdvancedMaterial: TColor;
      T2Component: TColor;
      RAM: TColor;
      Tradegoods: TColor;
      Datacore: TColor;
      Mineral: TColor;
      CapComponent: TColor;
      CapT2Component: TColor;
      Salvage: TColor;
      DataInterface: TColor;
      Unknown: TColor;

      CustomColorA: String;
      CustomColorB: String;
      CustomColorC: String;
      CustomColorD: String;
      CustomColorE: String;
      CustomColorF: String;
      CustomColorG: String;
      CustomColorH: String;
      CustomColorI: String;
      CustomColorJ: String;
      CustomColorK: String;
      CustomColorL: String;
      CustomColorM: String;
      CustomColorN: String;
      CustomColorO: String;
      CustomColorP: String;

      constructor Create;
      procedure Load(color: SColor);
      function Save: SColor;

      function GetColor(itemtype: EItemType): TColor;
  end;

implementation

constructor TColors.Create;
begin
  self.ColorShowInfo := true;
  self.ColorEditItems := true;
  self.ColorShoppingList := true;

  self.T1Item := clWindowText;
  self.T2Item := clWindowText;
  self.AdvancedMaterial := clWindowText;
  self.T2Component := clWindowText;
  self.RAM := clWindowText;
  self.Tradegoods := clWindowText;
  self.Datacore := clWindowText;
  self.Mineral := clWindowText;
  self.CapComponent := clWindowText;
  self.CapT2Component := clWindowText;
  self.Salvage := clWindowText;
  self.DataInterface := clWindowText;
  self.Unknown := clWindowText; 
  self.CustomColorA := 'ColorA=000000';
  self.CustomColorB := 'ColorA=000000';
  self.CustomColorC := 'ColorA=000000';
  self.CustomColorD := 'ColorA=000000';
  self.CustomColorE := 'ColorA=000000';
  self.CustomColorF := 'ColorA=000000';
  self.CustomColorG := 'ColorA=000000';
  self.CustomColorH := 'ColorA=000000';
  self.CustomColorI := 'ColorA=000000';
  self.CustomColorJ := 'ColorA=000000';
  self.CustomColorK := 'ColorA=000000';
  self.CustomColorL := 'ColorA=000000';
  self.CustomColorM := 'ColorA=000000';
  self.CustomColorN := 'ColorA=000000';
  self.CustomColorO := 'ColorA=000000';
  self.CustomColorP := 'ColorA=000000';
end;

procedure TColors.Load(color: SColor);
begin
  self.ColorShowInfo := color.ColorShowInfo;
  self.ColorEditItems := color.ColorEditItems;
  self.ColorShoppingList := color.ColorShoppingList;

  self.T1Item := color.T1Item;
  self.T2Item := color.T2Item;
  self.AdvancedMaterial := color.AdvancedMaterial;
  self.T2Component := color.T2Component;
  self.RAM := color.RAM;
  self.Tradegoods := color.Tradegoods;
  self.Datacore := color.Datacore;
  self.Mineral := color.Mineral;
  self.CapComponent := color.CapComponent;
  self.CapT2Component := color.CapT2Component;
  self.Salvage := color.Salvage;
  self.DataInterface := color.DataInterface;
  self.Unknown := color.Unknown;

  self.CustomColorA := color.CustomColorA;
  self.CustomColorB := color.CustomColorB;
  self.CustomColorC := color.CustomColorC;
  self.CustomColorD := color.CustomColorD;
  self.CustomColorE := color.CustomColorE;
  self.CustomColorF := color.CustomColorF;
  self.CustomColorG := color.CustomColorG;
  self.CustomColorH := color.CustomColorH;
  self.CustomColorI := color.CustomColorI;
  self.CustomColorJ := color.CustomColorJ;
  self.CustomColorK := color.CustomColorK;
  self.CustomColorL := color.CustomColorL;
  self.CustomColorM := color.CustomColorM;
  self.CustomColorN := color.CustomColorN;
  self.CustomColorO := color.CustomColorO;
  self.CustomColorP := color.CustomColorP;
end;

function TColors.Save: SColor;
begin
  result.ColorShowInfo := self.ColorShowInfo;
  result.ColorEditItems := self.ColorEditItems;
  result.ColorShoppingList := self.ColorShoppingList;

  result.T1Item := self.T1Item;
  result.T2Item := self.T2Item;
  result.AdvancedMaterial := self.AdvancedMaterial;
  result.T2Component := self.T2Component;
  result.RAM := self.RAM;
  result.Tradegoods := self.Tradegoods;
  result.Datacore := self.Datacore;
  result.Mineral := self.Mineral;
  result.CapComponent := self.CapComponent;
  result.CapT2Component := self.CapT2Component;
  result.Salvage := self.Salvage;
  result.DataInterface := self.DataInterface;
  result.Unknown := self.Unknown;

  result.CustomColorA := self.CustomColorA;
  result.CustomColorB := self.CustomColorB;
  result.CustomColorC := self.CustomColorC;
  result.CustomColorD := self.CustomColorD;
  result.CustomColorE := self.CustomColorE;
  result.CustomColorF := self.CustomColorF;
  result.CustomColorG := self.CustomColorG;
  result.CustomColorH := self.CustomColorH;
  result.CustomColorI := self.CustomColorI;
  result.CustomColorJ := self.CustomColorJ;
  result.CustomColorK := self.CustomColorK;
  result.CustomColorL := self.CustomColorL;
  result.CustomColorM := self.CustomColorM;
  result.CustomColorN := self.CustomColorN;
  result.CustomColorO := self.CustomColorO;
  result.CustomColorP := self.CustomColorP;
end;



function TColors.GetColor(itemtype: EItemType): TColor;
begin
  case itemtype of
    IT_T1Item: result := T1Item;
    IT_T2Item: result := T2Item;
    IT_AdvancedMaterial: result := AdvancedMaterial;
    IT_T2Component: result := T2Component;
    IT_RAM: result := RAM;
    IT_Tradegoods: result := Tradegoods;
    IT_Datacore: result := Datacore;
    IT_Mineral: result := Mineral;
    IT_CapComponent: result := CapComponent;
    IT_CapT2Component: result := CapT2Component;
    IT_Salvage: result := Salvage;
    IT_DataInterface: result := DataInterface;
    IT_Unknown: result := Unknown;
  else result := clDefault; 
  end;
end;

end.
